package com.wrk._1_语法._03_分支;

import java.util.Scanner;

public class _010_按位输出数字 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入数字");
        //
        int number = scanner.nextInt();
        int digit=0;
        int digit1=0;
        int digit2=0;
        int digit3=0;
        int digit4=0;
        //
        if (number > 0 && number <= 99999){
            if (number < 10){
                digit= number%10;
                System.out.println("个位:"+digit);
            } else if (number >= 10 && number < 100) {
                digit = number%10;
                digit1 = (number/10)%10;
                System.out.println("十位:"+digit);
                System.out.println("个位:"+digit1);
            } else if (number >= 100 && number < 1000) {
                digit = number%10;
                digit1 = (number/10)%10;
                digit2 = (number/100)%10;
                System.out.println("百位:"+digit);
                System.out.println("十位:"+digit1);
                System.out.println("个位:"+digit2);
            } else if (number >= 1000 && number < 10000) {
                digit = number%10;
                digit1 = (number/10)%10;
                digit2 = (number/100)%10;
                digit3 = (number/1000)%10;
                System.out.println("千位:"+digit);
                System.out.println("百位:"+digit1);
                System.out.println("十位:"+digit2);
                System.out.println("个位:"+digit3);
            } else if (number >= 10000 && number <= 99999) {
                digit = number%10;
                digit1 = (number/10)%10;
                digit2 = (number/100)%10;
                digit3 = (number/1000)%10;
                digit4 = (number/10000)%10;
                System.out.println("万位:"+digit);
                System.out.println("千位:"+digit1);
                System.out.println("百位:"+digit2);
                System.out.println("十位:"+digit3);
                System.out.println("个位:"+digit4);
            }
        }else {
            System.out.println("输入错误");
        }
        scanner.close();
    }
}
